import base_behavior from "../../behavior/base_behavior";
import list_behavior from "../../behavior/list_behavior";

Page({
    behaviors:[base_behavior,list_behavior],
    data: {
        nav:{
            title:'商品列表',
        },
    },
    onLoad: function (options = {}) {

        (async () => {

            const {cate_id, key} = options
            this.setData({
                [`list.url`]:'/goods/paginate',
                [`list.where`]: {
                    cate_id: cate_id || 0,
                    key: key || '',
                },
                options:options||{},
            })
            this.setList(1)

        })()

    },

    searchSub(e){
        const {value} = e.detail
        this.setData({
            [`list.where`]: {
                key: value,
            },
        })
        this.setList(1)
    },
});
